/**
 * Created by yjj on 2017/5/4.
 */
import axios from 'axios';
import {API_NEW_VERSION} from '../api';
var qs = require('qs');
const LOADING_LISTS_CONTAIN_ROUTES_NO_PAGE = API_NEW_VERSION + 'loading_lists_contain_routes_no_page';

const LOADING_LISTS_PRINT_LIST = API_NEW_VERSION + 'loading_lists_print_list';

// 获取装车列表不分页
export const searchLoadingListNoPage = params => {
  return axios.get(LOADING_LISTS_CONTAIN_ROUTES_NO_PAGE, {params: params});
};
export const printLoadingList = ids => {
  return axios.post(LOADING_LISTS_PRINT_LIST, qs.stringify({ids: ids.join(',')}));
};

export const addLoadingList = params => {
  return axios.post(API_NEW_VERSION + 'loading_lists', params);
};

export const pageLoadingList = params => {
  return axios.get(API_NEW_VERSION + 'loading_lists', {params: params});
};

export const pageLoadingListContentRoutes = params => {
  return axios.get(API_NEW_VERSION + 'loading_lists_contain_routes', {params: params});
};

export const pageLoadingListContentTracks = params => {
  return axios.get(API_NEW_VERSION + 'loading_lists_contain_tracks', {params: params});
};

export const deleteLoadingList = ids => {
  return axios.delete(API_NEW_VERSION + 'loading_lists/' + ids);
};

export const getLoadingList = id => {
  return axios.get(API_NEW_VERSION + 'loading_lists/' + id);
};

export const modifyLoadingList = (ids, params) => {
  return axios.post(API_NEW_VERSION + 'loading_lists/' + ids, {params: params});
};

/**
 * 发车
 */
export const depart = params => {
  return axios.post(API_NEW_VERSION + 'loading_lists/depart', params);
};

export const getOrganizationById = id => {
  return axios.get(API_NEW_VERSION + 'organizations/' + id);
};

export const specialBoardStatistics = () => {
  return axios.get(API_NEW_VERSION + 'loading_lists/special_board_statistics');
};
